const mongoose = require('mongoose');
var secret = require('../config/credentials');


module.exports = function(){

    mongoose.connect(secret.mongo.connectStr,{useNewUrlParser:true});
    const con = mongoose.connection;
    con.on('error', console.error.bind(console, '连接数据库失败'));
    con.once('open',()=>{
        //成功连接
        console.log('mongo connect ok')
    })
}